{extend name="base"}
{block name="title"}服务开启的配置列表{/block}
{block name="head"}
<style type="text/css">
    .border-table tbody th {text-align: center;}
    *{font-size: 13px;}
</style>
{/block}
{block name="body"}
<body class="mainbody">
<form>
    <!--导航栏-->
    <div class="location">
        <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
        <a href="{:url('index/home')}" class="home"><i class="iconfont icon-home"></i><span>首页</span></a>
        <i class="arrow iconfont icon-arrow-right"></i>
        <span>服务开启的配置列表</span>
    </div>
    <!--/导航栏-->


    <div class="table-container">
        <table class="ltable border-table">
            <tr align="center" >
                <th>排序</th>
                <th>服务名称</th>
                <th>App端口</th>
                <th>日志路径名称</th>
                <th>渠道</th>
                <th>起始时间</th>
                <th>修改时间</th>
                <th>操作</th>
            </tr>
            {empty name="page"}
            <tr><td colspan="10">Oh~暂无数据!</td></tr>
            {else/}
            {volist name="page" id="v"}
            <tr data-id="{$v.ID}" data-chan="{$v.Channel}">
                <td>{$v.ID}</td>
                <td>{$v.ServerName}</td>
                <td>{$v.AppAddr}</td>
                <td>{$v.LogdirName}</td>
                <td>{$v.Channel}</td>
                <td>{$v.CreateTime}</td>
                <td>{$v.UpdateTime}</td>
                <td>
                    <input type="button" class="a" value="配置详情" />
                </td>
            </tr>
            {/volist}
            {/empty}
        </table>
    </div>


    <div class="page-footer"><div class="btn-wrap">{$page->render()}</div></div>

</form>
<script type="application/javascript">
    $(function(){
        $('input.a').click(function () {  // 网络配置详情修改
            var id = $(this).parents('tr').data('id');
            var chan = $(this).parents('tr').data('chan');
            var url = "{:url('srvdetail')}?id=" + id;
            dialog({
                title: '服务[' + chan + ']配置详情',
                url: url,
                width: 820,
                height: 550,
                okValue: '确定',
                cancelValue: '取消',
                cancel: function () {},
                ok: function () {
                    var f = $('iframe', this.node);
                    var v = $('form', f.contents()).serialize();
                    console.log(v);
                    $.post(url, v, function (resp, text, xhr) {
                        console.log(resp);
                        alert(resp.error);
                        if (resp.errno == 0 || resp.errno == 110) {
                            location.reload();
                        }
                    });
                    return false;
                }
            }).showModal();
        });
    })
</script>
</body>
{/block}